package com.javafactroy.kunlong.api.iface;


import com.javafactroy.kunlong.client.feign.dto.ApiPageInfo;
import com.javafactroy.kunlong.client.feign.dto.ApiResult;
import com.javafactroy.kunlong.client.feign.dto.PageInfoDto;
import org.springframework.web.bind.annotation.*;

import java.util.List;

public interface IOpenWebService<T extends PageInfoDto> {

    @PostMapping("save")
    @ResponseBody
    ApiResult<Integer> save(@RequestBody T entity);

    @PostMapping("saveBatch")
    @ResponseBody
    ApiResult<Integer> saveBatch(@RequestBody List<T> entities);

    @PostMapping("insert")
    @ResponseBody
    ApiResult<Integer> insert(@RequestBody T entity);

    @PostMapping("update")
    @ResponseBody
    ApiResult<Integer> update(@RequestBody T entity);

    @PostMapping("updateNotNull")
    @ResponseBody
    ApiResult<Integer> updateNotNull(@RequestBody T entity);


    @DeleteMapping("deleteByPkey")
    @ResponseBody
    ApiResult<Integer> deleteByPkey(@RequestBody T entity);

    @DeleteMapping("deleteBy")
    @ResponseBody
    ApiResult<Integer> deleteBy(@RequestBody T entity);

    @PostMapping("selectCount")
    @ResponseBody
    ApiResult<Integer> selectCount(@RequestBody T entity);

    @GetMapping("selectByPkey")
    @ResponseBody
    ApiResult<T> selectByPkey(@RequestParam("pkey") Long pkey);

    @PostMapping("select")
    @ResponseBody
    ApiResult<List<T>> select(@RequestBody T entity);


    //    @PostMapping("selectAll")
    //    @ResponseBody
    //    ApiResult<List<T>> selectAll();

    @PostMapping("query")
    @ResponseBody
    ApiResult<ApiPageInfo<T>> query(@RequestBody T entity);


    @PostMapping("count")
    @ResponseBody
    ApiResult<Long> count(@RequestBody T entity);

//    @ApiOperation("导出")
//    @PostMapping("export")
//    void export(HttpServletResponse response, @RequestBody T param) throws IOException;


}
